package com.example.mybatisplus.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.mybatisplus.model.domain.Dot;
import com.example.mybatisplus.model.domain.Keeper;
import com.example.mybatisplus.model.domain.Student;
import com.example.mybatisplus.model.domain.Teacher;
import com.example.mybatisplus.mapper.TeacherMapper;
import com.example.mybatisplus.service.TeacherService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zzy
 * @since 2024-06-24
 */
@Service
public class TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher> implements TeacherService {


    public List<Teacher> selectTeacherByNameAndAccount(Dot dot) {
        QueryWrapper<Teacher> wrapper = new QueryWrapper<Teacher>()
                .like("name", dot.getData().get("teacherName"))
                .like("account", dot.getData().get("teacherAccount"));
        Page<Teacher> teacherPage = new Page<>(dot.getPageNo(), dot.getPageSize());
        IPage<Teacher> teacherIPage = baseMapper.selectPage(teacherPage, wrapper);
        return teacherIPage.getRecords();

    }

    @Override
    public List<Teacher> listByAccount(List<String> idList) {

        List<Teacher> teachers = this.getBaseMapper().listByAccounts(idList);
        return teachers;
    }
}
